$("#imgPathF").fileinput({
    //'previewFileType':'any',
    allowedFileExtensions:['xlsx', 'xls'],
    uploadUrl: "./FileUpload/fileUpload",
    language:'zh',
    //excel大小限制，50M
    maxFileSize:50000,
    maxFileCount:1,
    minFileCount:1,
    initialPreviewShowDelete:true,
    //dropZoneTitleClass: 'file_upload_title',
    dropZoneEnabled: false
});
//上传成功后处理方法
$("#imgPathF").on('fileuploaded', function(event, data, previewId, index) {
    $("#imgPath").val(data.response["imgPathF"])
});
$("#add_form").bootstrapValidator({
    message: 'This value is not valid',
// 定义未通过验证的状态图标
    feedbackIcons: {
        /*输入框不同状态，显示图片的样式*/
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
// 字段验证
    fields: {
// 运输成本
        placeCode: {
            message: '格式非法',
            validators: {
// 非空
                notEmpty: {
                    message: '上传文件不能为空'
                },
// 限制字符串长度
                stringLength: {},
// 基于正则表达是的验证
                regexp: {
                    regexp: /^[\u4E00-\u9FA5A-Za-z0-9]+$/,
                    message: '上传文件由xlsx和xls结尾'
                }
            }
        },
    }
})
function form_sub() {
    var flag = $("#add_form").data("bootstrapValidator").isValid();
    console.log($("#imgPath").val())
    if (flag) {
        ajaxs('./tUnregularConfirm/importMql', "POST", {"excelPath":$("#imgPath").val()}, false, function (data) {
                if (data.type == 1) {
                    $("#add_form").modal('hide');
                    layer.msg(data.message);
                    $("#BannerTable table").bootstrapTable('refresh');
                } else {
                    layer.msg(data.message);
                }
            }
        );
    }
}